package com.example.livemall.mapper;

import com.example.livemall.entity.Info;
import com.example.livemall.entity.Item;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.util.List;

/**
 * 热门推荐服务数据层
 */
@Mapper
public interface RecommendationMapper {

    /**
     * 查询商品列表
     *
     * @param city
     * @return
     */
    @Select("select * from item where city = #{city} and recommendation = 1 order by recoSort desc limit 0, 4")
    List<Item> selectRecommendationList(@Param("city") String city);

    @Select("select * from item where city != #{city} and recommendation = 1 order by recoSort desc limit 0, #{size}")
    List<Item> selectOtherRecommendationList(@Param("city") String city, @Param("size") Integer size);

    @Select("select * from info where item_id = #{item_id}")
    Info selectInfo(@Param("item_id") String itemId);

    @Select("select url from imgs where item_id = #{item_id}")
    List<String> selectImg(@Param("item_id") String itemId);

}